#!/bin/sh /etc/rc.common

START=99

protocol='nec'
keyfile=/etc/rc_keymaps/keyes
key_file=$(sed 's/[ \t]/=/g' $keyfile | sed -e :a -e '$!N;s/\n/,/;ta' -e 'P;D')

start() {
 /usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit
 ir-keytable -c 2>/dev/null
 ir-keytable -p ${protocol} -k ${key_file} 2>/dev/null
 /usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event* &
}

restart() {
 /usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit
 ir-keytable -c 2>/dev/null
 ir-keytable -p ${protocol} -k ${key_file} 2>/dev/null
 /usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event* &
}

reload() {
 /usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit
 ir-keytable -c 2>/dev/null
 ir-keytable -p ${protocol} -k ${key_file} 2>/dev/null
 /usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event* &
}

